package auth

import (
	"github.com/gin-gonic/gin"
	v1 "last/app/controllers/v1"
	adminModel "last/app/models/admin"
	"last/pkg/respose"
)

type AdminMeController struct {
	v1.BaseController
}

// Me 我的信息
func (a AdminMeController) Me(c *gin.Context) {
	userName, ok := c.Get("userName")
	if !ok {
		respose.Failed(c, "token 解析错误")
		return
	}
	var adminInfo = adminModel.Admins{}
	err := adminModel.Me(userName, &adminInfo)
	if err != nil || adminInfo.ID < 1 {
		respose.Failed(c, "用户不存在")
		return
	}
	respose.Success(c, adminInfo, "获取成功")
}
